<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>运输管理</title>
<style>
	<style>
		  /* 整体设置 */
		  *{margin:0px;padding:0px;}
		   
		  /**
		   * 设置日历的大小
		   */
		  .calendar{
		 /*   width: 80%;
		    height: 60%;
		    display: block; */
			
			top: 10%;                  /* 距顶部50%*/   
			left: 20%;                  /* 距左边50%*/   
			height: 60%;    /*margin-top为height一半的负值*/   
			width:60%;    /*margin-left为width一半的负值*/  
			
		  }
		  
		  
		   
		  /**
		   * 设置日历顶部盒子
		   */
		  .calendar .calendar-title-box{
		    position: relative;
		    width: 100%;
		    height: 36px;
		    line-height: 36px;
		    text-align:center;
		    border-bottom: 1px solid #ddd;
		  }
		   
		  /**
		   * 设置上个月的按钮图标
		   */
		  .calendar .prev-month {
		    position: absolute;
		    top: 12px;
		    left: 0px;
		    display: inline-block;
		    width: 0px;
		    height: 0px;
		    border-left: 0px;
		    border-top: 6px solid transparent;
		    border-right: 8px solid #999;
		    border-bottom: 6px solid transparent;
		    cursor: pointer;
		  }
		   
		  /**
		   * 设置下个月的按钮图标
		   */
		  .calendar .next-month {
		    position: absolute;
		    top: 12px;
		    right: 0px;
		    display: inline-block;
		    width: 0px;
		    height: 0px;
		    border-right: 0px;
		    border-top: 6px solid transparent;
		    border-left: 8px solid #999;
		    border-bottom: 6px solid transparent;
		    cursor: pointer;
		  }
		   
		   
		  /* 设置日历表格样式 */
		  .calendar-table{
		    width: 100%;
		    border-collapse: collapse;
		    text-align:center;
		  }
		   
		  /* 表格行高 */
		  .calendar-table tr{
		    height: 30px;
		    line-height: 30px;
		  }
		   
		  /* 当前天 颜色特殊显示 */
		  .currentDay {
		    color: red;
		  }
		   
		  /* 本月 文字颜色 */
		  .currentMonth {
		    color: #999;
		  }
		  
		  /* 本月 取胆日期 */
		  .mohthGetCashbox {
		    color: red;
		  }
		  
		  /* 本月 取胆日期 */
		  .mohthGetCashbox2 {
		    color: red;
		  }
		   
		  /* 其他月颜色 */
		  .otherMonth{
		    color: #ede;
		  }
		  
		  
		  
		 
		  
		 /* .layui-layer-btn {
		      text-align: center;
		      padding: 0 10px 12px;
		      pointer-events: auto;
		  } */
		  
		
		   
		   
		   .typeContentDiv{
		   			top: 70%;                  /* 距顶部50%*/   
		   			left: 20%;                  /* 距左边50%*/   
		   			
		    }
			.divIdClass{
						top: 75%;                  /* 距顶部50%*/   
						left: 20%;                  /* 距左边50%*/   
						
			 }
			 
			  
			  .typeContent{
			    /*position: absolute;      /*绝对定位*/
			  			/*top: 75%;                  /* 距顶部50%*/   
			  			/*left: 10%;                  /* 距左边50%*/   
			  			height: 65px;    /*margin-top为height一半的负值*/   
			  			width: 85%;    /*margin-left为width一半的负值*/  
			  			
			   }
			
			
		 
	</style>
	
</style>
</head>
<body>

<div class="page-container"  style="padding: 5px;" >
	<div class="mt-20" style="margin-left:25%;" >
			分公司:
			<span class="select-box inline">
			<select class="select" id="comId" name="comId">
				<option value="">请选择分公司</option>
			
			</select>
			</span>
			票务室:
			<span class="select-box inline">
			<select class="select" id="toId" name="toId">
				<option value="">请选择票务室</option>
			</select> 
			</span>
		<div class='calendar' id='calendar'>
		</div>
		
		
			<div class="typeContentDiv">
				<span>备注:</span>
			</div>
			<div class="divIdClass" id="divId">
			</div>
				<textarea   id="typeContent" class="typeContent"  style="outline:none;resize:none;height: 30%; " >
				</textarea>
			
		
		<footer style=" -position: absolute;bottom: 50px;left: 45%;" class="mt-20">
		       
			<input id="reg"  style=" display:none; "   class="btn btn-primary radius" onclick="regClickSubmit()" type="button" value="&nbsp;&nbsp;提交申请&nbsp;&nbsp;">
			<input id="reg2"  style=" display:none; "   class="btn btn-primary radius" onclick="regClickSubmit2()" type="button" value="&nbsp;&nbsp;保存&nbsp;&nbsp;">
			<input id="inputId1"  style=" display:none;"  class="btn btn-primary radius" onclick="regClick()"  type="button" value="&nbsp;&nbsp;通过&nbsp;&nbsp;">
			 <input id="inputId2"  style=" display:none; " class="btn btn-primary radius" onclick="noRegClick()"  type="button" value="&nbsp;&nbsp;不通过&nbsp;&nbsp;">
		</footer>
	</div>
	
	
</div>




<!-- <textarea   id="typeContent" style=" display:none; width:95%;height: 200px;outline:none;resize:none; " >
</textarea> -->

	

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
		<script type="text/javascript" src="js/jquery.base64.js"></script>

<script type="text/javascript" src="js/vue.js" charset="utf-8"></script>


<script type="text/javascript">

var titleName= localStorage.getItem("titleName")
var workPlanTitle = "";
var stepType = localStorage.getItem("stepType");
var companyId = '';
var officeId = '';
var serialNumber="";
var  username ="";
$(function(){

			if("company"==stepType){ 
				$("#reg").attr("style", "display:blank;");
				$("#reg2").attr("style", "display:blank;");
			}else if("gjjt"==stepType){
				$("#inputId1").attr("style", "display:blank;");
				$("#inputId2").attr("style", "display:blank;");
				$("#reg").attr("style", "display:blank;");
				//$("#reg").value="&nbsp;&nbsp;提交申请22222&nbsp;&nbsp;";
				$("#reg").val("确定修改");
			}else{
				$("#inputId1").attr("style", "display:blank;");
				$("#inputId2").attr("style", "display:blank;");
			}
			var url = location.search; //获取url中"?"符后的字串
			var strs = '';
		
			if (url.indexOf("?") != -1) { //判断是否有参数
				var str = url.substr(1); //从第一个字符开始 因为第0个是?号 获取所有除问号的所有符串
				strs = str.split("&"); //用等号进行分隔 （因为知道只有一个参数 所以直接用等号进分隔 如果有多个参数 要用&号分隔 再用等号进行分隔）
				console.log("==="+strs[0]+"/"+strs[1]); //直接弹出第一个参数 （如果有多个参数 还要进行循环的）
				companyId = strs[0].substr(strs[0].indexOf("=")+1,strs[0].length);//id=C0000027
				officeId = strs[1].substr(strs[1].indexOf("=")+1,strs[1].length);;//step=1
				serialNumber = strs[2].substr(strs[2].indexOf("=")+1,strs[2].length);;//step=1
			}
			var comId;
			var toId;
			var userinfo =getUserInfo();//window.localStorage.getItem("userinfo");
			//var groups =userinfo.groups
			username =userinfo.username;
			var myArray;
			
				$.ajax({
					type: 'get',
					url: report_service+'/getAllCompany',
					/* beforeSend: function (request) {
									request.setRequestHeader("Authorization", "Bearer " + getToken());
								}, */
					dataType: 'json',
					async: false,
					success: function(data){
						var list =  eval('(' + data.list + ')');
						for(var i = 0;i<list.length;i++){
							$("#comId").append("<option value='"+list[i].companyid+"'>"+list[i].companyname+"</option>");				
						}
					},
					error: function(data){
						console.log(data.msg);
					}
				});
				
				$.ajax({
					type: 'get',
					url: report_service+'/getTicktOfficeByCom',
					/* beforeSend: function (request) {
									request.setRequestHeader("Authorization", "Bearer " + getToken());
								}, */
					data:{
						"comId":companyId
					},
					cache:false,    
					dataType:'json',
					async: false,
					success: function(data){
						$("#comId").val(companyId);
						var list =  eval('(' + data.list + ')');
						for(var i=0;i<list.length;i++){
							var option = '<option value="'+list[i].toiid+'">'+list[i].toiname+'</option>';
							$("#toId").append(option);
						}
					},
					error:function(){
						alert("请求失败");
					}
				});
				
				
				// $.ajax({
				// 	type: 'get',
				// 	url: report_service+'/getUserByname',
				// 	data:{
				// 		"username": username
				// 	},
				// 	async: false,
				
				// 	dataType: 'json',
				// 	success: function(data){
				// 		var list =  eval('(' + data.list + ')');
				// 		if(list[0].officeId.indexOf("1")==0){
				// 			$("#comId").val(companyId);
				// 			comId =companyId; //list[0].companyId;
							
				// 			$.ajax({
				// 				type: 'get',
				// 				url: report_service+'/getTicktOfficeByCom',
								
				// 				data:{
				// 					"comId":comId
				// 				},
				// 				cache:false,    
				// 				dataType:'json',
				// 				async: false,
				// 				success: function(data){
									
				// 					var list =  eval('(' + data.list + ')');
				// 					for(var i=0;i<list.length;i++){
				// 						var option = '<option value="'+list[i].toiid+'">'+list[i].toiname+'</option>';
				// 						$("#toId").append(option);
				// 					}
				// 				},
				// 				error:function(){
				// 					alert("请求失败");
				// 				}
				// 			});
				// 			$("#toId").val(officeId);
				// 			toId =officeId; //list[0].officeId;
				// 			$("#comId").attr("disabled","disabled");
				// 			$("#toId").attr("disabled","disabled");
				// 		}
				// 		if(list[0].officeId.indexOf("1") == -1  && list[0].companyId.indexOf("1")==0 ){
				// 			$("#comId").val(companyId);
				// 			comId = companyId;//list[0].companyId;
				// 			$.ajax({
				// 				type: 'get',
				// 				url: report_service+'/getTicktOfficeByCom',
								
				// 				data:{
				// 					"comId":comId
				// 				},
				// 				cache:false,    
				// 				dataType:'json',
				// 				async: false,
				// 				success: function(data){
											
				// 					//var list = data.list;
				// 					var list =  eval('(' + data.list + ')');
				// 					for(var i=0;i<list.length;i++){
				// 						var option = '<option value="'+list[i].toiid+'">'+list[i].toiname+'</option>';
				// 						$("#toId").append(option);
				// 					}
				// 				},
				// 				error:function(){
				// 					alert("请求失败");
				// 				}
				// 			});
				// 			$("#comId").attr("disabled","disabled");
				// 		}
				// 	},
				// 	error: function(data){
				// 		console.log(data.msg);
				// 	}
				// });
			$("#comId").attr("disabled","disabled");
			$("#toId option[value='"+officeId+"']").attr("selected", "selected");
			$("#toId").attr("disabled","disabled");
			
			// $("#comId").val(companyId);
			// alert(officeId)
			// $("#toId").val(officeId);
	console.log(companyId+"===="+officeId+"===="+serialNumber)
	queryTable(companyId,officeId,serialNumber);
	
	
	
	 //queryCompany();
});
				

function queryTable(companyId,officeId,serialNumber){
	//console.log(companyId+"===="+officeId+"===="+serialNumber)
	
    $.ajax({
    	type: 'post',
    	url:reportForm+'workPlan/getWorkPlanByComAndOffAndSerialNumber',
    	data: {
			companyId:companyId,
			officeId:officeId,
			//serialNumber:serialNumber,
			titleName:titleName
    	},
    	dataType: 'json',
    	success: function(data){
			var workPlanTitle= data.workPlanList;
			var WorkPlanRemarksList= data.WorkPlanRemarksList;
			
			creationMonth(workPlanTitle,titleName,WorkPlanRemarksList);
    	},
    	error:function(data) {
    		console.log(data.msg);
    	},
    });

}


function creationMonth(workPlanTitle,titleName,WorkPlanRemarksList){
	
	  /*
	   * 用于记录日期，显示的时候，根据dateObj中的日期的年月显示
	   */
	  var dateObj = (function(){
	    var _date = new Date();    // 默认为当前系统时间
	    return {
	      getDate : function(){
	        return _date;
	      },
	      setDate : function(date) {
	        _date = date;
	      }
	    };
	  })();
	 
	  // 设置calendar div中的html部分
	  renderHtml();
	  // 表格中显示日期
	  showCalendarData();
	  // 绑定事件
	 // bindEvent();
	 
	  /**
	   * 渲染html结构
	   */
	  function renderHtml() {
	    var calendar = document.getElementById("calendar");
	    var titleBox = document.createElement("div");  // 标题盒子 设置上一月 下一月 标题
	    var bodyBox = document.createElement("div");  // 表格区 显示数据
	 
	    // 设置标题盒子中的html
	    titleBox.className = 'calendar-title-box';
	    titleBox.innerHTML = //"<span class='prev-month' id='prevMonth'></span>" +
	      "<span class='calendar-title' id='calendarTitle'></span>" 
	     // "<span id='nextMonth' class='next-month'></span>";
	    calendar.appendChild(titleBox);    // 添加到calendar div中
	 
	    // 设置表格区的html结构
	    bodyBox.className = 'calendar-body-box';
	    var _headHtml = "<tr >" + 
	              "<th style='text-align:center'>日</th>" +
	              "<th style='text-align:center'>一</th>" +
	              "<th style='text-align:center'>二</th>" +
	              "<th style='text-align:center'>三</th>" +
	              "<th style='text-align:center'>四</th>" +
	              "<th style='text-align:center'>五</th>" +
	              "<th style='text-align:center'>六</th>" +
	            "</tr>";
	    var _bodyHtml = "";
	
	 
	    // 一个月最多31天，所以一个月最多占6行表格
	    for(var i = 0; i < 6; i++) {  
	      _bodyHtml += "<tr>" +
	              "<td></td>" +
	              "<td></td>" +
	              "<td></td>" +
	              "<td></td>" +
	              "<td></td>" +
	              "<td></td>" +
	              "<td></td>" +
	            "</tr>";
	    }
	    bodyBox.innerHTML = "<table id='calendarTable' class='calendar-table'>" +
	              _headHtml + _bodyHtml +
	              "</table>";
	    // 添加到calendar div中
	    calendar.appendChild(bodyBox);
	  }
	 
	  /**
	   * 表格中显示数据，并设置类名
	   */
	  function showCalendarData() {
		 console.log(titleName)
	    var _year =titleName.substr(0,4) //dateObj.getDate().getFullYear();
		console.log(_year)
	    var _month = titleName.substr(5,2)//dateObj.getDate().getMonth() + 1;
		if(_month.indexOf("月")==1){
		_month = _month.substr(0,1);
		}
		console.log(_month)
		/* if(){
			
		} */
	    var _dateStr = getDateStr(dateObj.getDate());
		console.log(_dateStr)
	 
	    // 设置顶部标题栏中的 年、月信息
	    var calendarTitle = document.getElementById("calendarTitle");
	    var titleStr = _year + "年" + _month+ "月";
	    calendarTitle.innerText = titleStr;
	 
	    // 设置表格中的日期数据
	    var _table = document.getElementById("calendarTable");
	    var _tds = _table.getElementsByTagName("td");
	    var _firstDay = new Date(_year, _month - 1, 1);  // 当前月第一天
	    for(var i = 0; i < _tds.length; i++) {
	      var _thisDay = new Date(_year, _month - 1, i + 1 - _firstDay.getDay());
	      var _thisDayStr = getDateStr(_thisDay);
	      _tds[i].innerText = _thisDay.getDate();
	      //_tds[i].data = _thisDayStr;
	      _tds[i].setAttribute('data', _thisDayStr);
	      /* if(_thisDayStr == getDateStr(new Date())) {    // 当前天
	        _tds[i].className = 'currentMonth';
	      }else */ if(_thisDayStr.substr(0, 6) == getDateStr(_firstDay).substr(0, 6)) {
			  //$("#typeContent").val(workPlanTitle[0].remarks);
			  //console.log(workPlanTitle[0].remarks)
			
			   //console.log(_thisDayStr)
			   var c=0;
			   _tds[i].className = 'day0';
			  for(var w = 0;w<workPlanTitle.length;w++){
				 // document.getElementById("typeContent").value="";
				 c++;
				if(c<10){
					c="0"+c;
				}
				if(_thisDayStr.substr(6, 8) ==c){
					 _tds[i].id=workPlanTitle[w].id;
					if("1"== workPlanTitle[w].day1){
						_tds[i].className = 'mohthGetCashbox';
						// _tds[i].style="border:1px solid red ;background-color: red;"
						 _tds[i].style="border:1px solid red ;"
						 _tds[i].innerHTML=_tds[i].innerHTML+'<span class="qwe"  style="font-size: 5px;"  >去</span>'
					}else{
						
					}
					
					if("2"== workPlanTitle[w].day1){
						_tds[i].className = 'mohthGetCashbox2';
						// _tds[i].style="border:1px solid red ;background-color: red;"
						 _tds[i].style="border:1px solid red ;"
						 _tds[i].innerHTML=_tds[i].innerHTML+'<span class="qwe"  style="font-size: 5px;"  >加急</span>'
					}
				}
			  }
			  
	       
	      }else {    // 其他月
	        _tds[i].className = 'otherMonth';
	      }
	    }
		
		var div=document.getElementById("divId");
		for(var c = 0;c<WorkPlanRemarksList.length;c++){
			var li = document.createElement("span")
			li.id=WorkPlanRemarksList[c].id;
			li.className="divSpanClass";
			//var unixTimestamp = new Date(parseInt( WorkPlanRemarksList[c].createTime )) ;
			//var commonTime = unixTimestamp.toLocaleString();
			var time =  WorkPlanRemarksList[c].createTime;
			 var tt = datetimeformat(time)
			
			 li.innerHTML ="用户 "+WorkPlanRemarksList[c].createName+" 在:"+ tt  +" 新增了内容:"+WorkPlanRemarksList[c].remarks;
			div.append(li);

			var br = document.createElement("br")
			div.append(br);
		}
		//$("#typeContent").text(workPlanTitle[0].remarks);
			$("#typeContent").text("");
	  }
	 
	  /**
	   * 绑定上个月下个月事件
	   */
	  function bindEvent() {
	    var prevMonth = document.getElementById("prevMonth");
	    var nextMonth = document.getElementById("nextMonth");
	    addEvent(prevMonth, 'click', toPrevMonth);
	    addEvent(nextMonth, 'click', toNextMonth);
	  }
	 
	  /**
	   * 绑定事件
	   */
	  function addEvent(dom, eType, func) {
		    console.log(dom.addEventListener)
	    if(dom.addEventListener) {  // DOM 2.0
	      dom.addEventListener(eType, function(e){
	        func(e);
	      });
	    } else if(dom.attachEvent){  // IE5+
	      dom.attachEvent('on' + eType, function(e){
	        func(e);
	      });
	    } else {  // DOM 0
	      dom['on' + eType] = function(e) {
	        func(e);
	      }
	    }
	  }
	 
	  /**
	   * 点击上个月图标触发
	   */
	  function toPrevMonth() {
	    var date = dateObj.getDate();
	    dateObj.setDate(new Date(date.getFullYear(), date.getMonth() - 1, 1));
	    showCalendarData();
	  }
	 
	  /**
	   * 点击下个月图标触发
	   */
	  function toNextMonth() {
	    var date = dateObj.getDate();
	    dateObj.setDate(new Date(date.getFullYear(), date.getMonth() + 1, 1));
	    showCalendarData();
	  }
	 
	  /**
	   * 日期转化为字符串， 4位年+2位月+2位日
	   */
	  function getDateStr(date) {
	    var _year = date.getFullYear();
	    var _month = date.getMonth() + 1;    // 月从0开始计数
	    var _d = date.getDate();
	     
	    _month = (_month > 9) ? ("" + _month) : ("0" + _month);
	    _d = (_d > 9) ? ("" + _d) : ("0" + _d);
	    return _year + _month + _d;
	  }
	  
	  if("company"==stepType||"gjjt"==stepType){
		  var table = document.getElementById("calendarTable");
		  var tds = table.getElementsByTagName('td');
		  for(var i = 0; i < tds.length; i++) {
		    addEvent(tds[i], 'click', function(e){
		  			var tdById= document.getElementById(e.target.getAttribute('id'));
		  		  if(e.target.getAttribute('class')=="day0"){
					  console.log(e.target.getAttribute('class'))
		  			tdById.className="mohthGetCashbox";
		  			tdById.style="border:1px solid red ;"
		  			tdById.innerHTML=tdById.innerHTML+'<span style="font-size: 5px;"  >去</span>'
		  		  }else if(e.target.getAttribute('class')=="mohthGetCashbox2"){
		  			
		  		  }else{
		  			  console.log(tdById)
		  			  tdById.className="day0";
		  			  tdById.style=""
		  			  if(tdById.innerHTML.substr(0,2).indexOf("<")=="1"){
		  				   tdById.innerHTML=tdById.innerHTML.substr(0,1)
		  			  }else{
		  				   tdById.innerHTML=tdById.innerHTML.substr(0,2)
		  			  }
		  		  }
		    });
		  }
	  }
	 
}

//  00 公司编辑
	//  01 集团审核
	//  02 物流审核    
	//  03 银行审核 
	//  04 发布      
	
	//  97 集团不通过
	//  98 物流不通过
	//  99 银行不通过

function regClickSubmit(){ //提交申请 
		var saveTdHtml = document.getElementsByClassName("mohthGetCashbox");
		//console.log(saveTdHtml)
		var ids = "";
		for(var i = 0;i<saveTdHtml.length;i++){
			ids+=saveTdHtml[i].id+",";
		}
		var day0TdHtml = document.getElementsByClassName("day0");
		
		var ids0 = "";
		for(var i = 0;i<day0TdHtml.length;i++){
			ids0+=day0TdHtml[i].id+",";
		}
		
		
	var divSpanClass = document.getElementsByClassName("divSpanClass");
	var remarksId = "";
	for(var i = 0;i<divSpanClass.length;i++){
		remarksId+=divSpanClass[i].id+",";
	}
	var step ="";
	if("company"==stepType){
		step="01";
	}else if("gjjt"==stepType){
		step="03";
	}

	 var typeContent = document.getElementById("typeContent").value;
					layer.confirm('确认要提交？', function(index) {
	
							$.ajax({
							 	type: 'post',
							 	url:reportForm+'workPlan/updateWorkPlanByIds',
							 	data: {
										titleName:titleName,
										companyId:companyId,
										officeId:officeId,
										serialNumber:serialNumber,
										ids:ids,
										ids0:ids0,
										step:step,
										username:username,
										remarksId:remarksId,
										typeContent:typeContent
							 	},
							 	dataType: 'json',
							 	success: function(data){
									var msg = 	data.msg;
									if (msg=="1") {
										layer.open({
											content: "成功！",
											title: '提交申请',
											yes: function(index, layero) {
												layer.close(index); //如果设定了yes回调，需进行手工关闭
												var index = parent.layer.getFrameIndex(window.name);
												parent.$('.btn-refresh').click();
												parent.layer.close(index);
											}
										});
										//
									} else {
										alert("提交失败")
									}
													
							 	},
							 	error:function(data) {
							 		console.log(data.msg);
							 	},
							 });
						});
		
}




function regClickSubmit2(){ //保存
		var saveTdHtml = document.getElementsByClassName("mohthGetCashbox");
		//console.log(saveTdHtml)
		var ids = "";
		for(var i = 0;i<saveTdHtml.length;i++){
			ids+=saveTdHtml[i].id+",";
		}
		var day0TdHtml = document.getElementsByClassName("day0");
		
		var ids0 = "";
		for(var i = 0;i<day0TdHtml.length;i++){
			ids0+=day0TdHtml[i].id+",";
		}
		
		var divSpanClass = document.getElementsByClassName("divSpanClass");
		var remarksId = "";
		for(var i = 0;i<divSpanClass.length;i++){
			remarksId+=divSpanClass[i].id+",";
		}
	
	 var typeContent = document.getElementById("typeContent").value;
	
							$.ajax({
							 	type: 'post',
							 	url:reportForm+'workPlan/updateWorkPlanByIds',
							 	data: {
									titleName:titleName,
									companyId:companyId,
									officeId:officeId,
									serialNumber:serialNumber,
									ids:ids,
									ids0:ids0,
									step:"00",
									username:username,
									remarksId:remarksId,
									typeContent:typeContent
							 	},
							 	dataType: 'json',
							 	success: function(data){
									var msg = 	data.msg;
									if (msg=="1") {
												//layer.close(index); //如果设定了yes回调，需进行手工关闭
												var index = parent.layer.getFrameIndex(window.name);
												parent.$('.btn-refresh').click();
												parent.layer.close(index);
										//
									} else {
										alert("提交失败")
									}
													
							 	},
							 	error:function(data) {
							 		console.log(data.msg);
							 	},
							 });
			
			
}

function regClick(){ //审核通过
		var saveTdHtml = document.getElementsByClassName("mohthGetCashbox");
		//console.log(saveTdHtml)
		var ids = "";
		var step = "";
		for(var i = 0;i<saveTdHtml.length;i++){
			ids+=saveTdHtml[i].id+",";
		}
		var day0TdHtml = document.getElementsByClassName("day0");
		
		var ids0 = "";
		for(var i = 0;i<day0TdHtml.length;i++){
			ids0+=day0TdHtml[i].id+",";
		}
		
		var divSpanClass = document.getElementsByClassName("divSpanClass");
		var remarksId = "";
		for(var i = 0;i<divSpanClass.length;i++){
			remarksId+=divSpanClass[i].id+",";
		}
		
		if("gjjt"===stepType){
			step="03"
		}else if("bjyh"===stepType){
			step="04"
		}else if("dtwl"===stepType){
			step="02"
		}
		
		var typeContent = document.getElementById("typeContent").value;
		$.ajax({
			type: 'post',
			url:reportForm+'workPlan/updateWorkPlanByIdsToExcmine',
			data: {
				titleName:titleName,
				companyId:companyId,
				officeId:officeId,
				serialNumber:serialNumber,
					ids:ids,
					ids0:ids0,
					step:step,
					remarksId:remarksId,
					username:username,
					typeContent:typeContent
			},
			dataType: 'json',
			success: function(data){
							var index = parent.layer.getFrameIndex(window.name);
							parent.$('.btn-refresh').click();
							parent.layer.close(index);
								
			},
			error:function(data) {
				console.log(data.msg);
			},
		 });
}



function noRegClick(){ //审核不通过

 var step = "";
				if("gjjt"===stepType){
					step="97"
				}else if("bjyh"===stepType){
					step="99"
				}else if("dtwl"===stepType){
					step="98"
				}
				   var typeContent = document.getElementById("typeContent").value;
				   
				   var saveTdHtml = document.getElementsByClassName("mohthGetCashbox");
				   //console.log(saveTdHtml)
				   var ids = "";
				   for(var i = 0;i<saveTdHtml.length;i++){
				   					ids+=saveTdHtml[i].id+",";
				   }
				   var day0TdHtml = document.getElementsByClassName("day0");
				   
				   var ids0 = "";
				   for(var i = 0;i<day0TdHtml.length;i++){
				   					ids0+=day0TdHtml[i].id+",";
				   }
				   
				   var divSpanClass = document.getElementsByClassName("divSpanClass");
				   var remarksId = "";
				   for(var i = 0;i<divSpanClass.length;i++){
				   	remarksId+=divSpanClass[i].id+",";
				   }
				   
					$.ajax({
						type: 'post',
						url:reportForm+'workPlan/updateWorkPlanByIdsToExcmine',
						data: {
							titleName:titleName,
							companyId:companyId,
							officeId:officeId,
							serialNumber:serialNumber,
							ids:ids,
							ids0:ids0,
							step:step,
							remarksId:remarksId,
							username:username,
							typeContent:typeContent
						},
						dataType: 'json',
						success: function(data){
							var msg = 	data.msg;
							var index = parent.layer.getFrameIndex(window.name);
							//layer.close(index); //关闭当前层
							parent.$('.btn-refresh').click();
							parent.layer.close(index); 
							
											
						},
						error:function(data) {
							console.log(data.msg);
						},
				    }); 
							
}
function datetimeformat(time) { 
	   var datetime = new Date(parseInt(time));
	   //获取年
	   var year = datetime.getFullYear();
	  //获取月
	   var month = datetime.getMonth() + 1 < 10 ? "0" + (datetime.getMonth() + 1) : datetime.getMonth() + 1;
	   //获取日
	   var date = datetime.getDate() < 10 ? "0" + datetime.getDate() : datetime.getDate();
	   //获取小时
	   var hour = datetime.getHours()< 10 ? "0" + datetime.getHours() : datetime.getHours();
	   //获取分钟
	   var minute = datetime.getMinutes()< 10 ? "0" + datetime.getMinutes() : datetime.getMinutes();
	   //获取秒
	   var second = datetime.getSeconds()< 10 ? "0" + datetime.getSeconds() : datetime.getSeconds();
	   //返回结果(可修改为自己要用的格式)
	   return year + "年" + month + "月" + date+"日"+hour+":"+minute+":"+second;
	}


</script>
</body>
</html>